package com.xxgc.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: Sjy
 * @Date :2023/10/8 - 10 - 08 - 11:12
 * 项目的路径映射
 */
@Configuration
public class VirtualPathConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置路径映射
        //服务器路径 如果是本地前面加file:
        String systemPath = "file:C:\\upload\\images\\";
        //匹配到由/images开头的就做路径映射
        registry.addResourceHandler("/images/**").addResourceLocations(systemPath);
    }

}
